/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author FIRE
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';
import { UploadApiResult } from '../sys/upload';
import { UploadFileParams } from '/#/axios';
import { SoRds } from './soRds';

const { ctxPath, adminPath } = useGlobSetting();

export interface CusFpApply extends BasicModel<CusFpApply> {
  cusCode?: string; // 客户编码
  isum?: number; // 申请金额
  kpStatus?: string; // 开票状态
  fpUrl?: string; // 发票链接
  overDate?: string; // 开票完成
  overBy?: string; // 开票人
  cusFpApplyRdsList?: any[]; // 子表列表
}

export const cusFpApplyList = (params?: CusFpApply | any) =>
  defHttp.get<CusFpApply>({ url: adminPath + '/shop/order/cusFpApply/list', params });

export const cusFpApplyListData = (params?: CusFpApply | any) =>
  defHttp.post<Page<CusFpApply>>({ url: adminPath + '/shop/order/cusFpApply/listData', params });

export const kpRdsListData = (params?: SoRds | any) =>
  defHttp.post<Page<SoRds>>({
    url: adminPath + '/shop/order/cusFpApply/kpRdsListData',
    params,
  });

export const cusFpApplyForm = (params?: CusFpApply | any) =>
  defHttp.get<CusFpApply>({ url: adminPath + '/shop/order/cusFpApply/form', params });

export const cusFpApplySave = (params?: any, data?: CusFpApply | any) =>
  defHttp.postJson<CusFpApply>({ url: adminPath + '/shop/order/cusFpApply/save', params, data });

export const cusFpApplyImportData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: ctxPath + adminPath + '/shop/order/cusFpApply/importData',
      onUploadProgress,
    },
    params,
  );

export const cusFpApplyDelete = (params?: CusFpApply | any) =>
  defHttp.get<CusFpApply>({ url: adminPath + '/shop/order/cusFpApply/delete', params });

export const updateStatus = (params?: CusFpApply | any) =>
  defHttp.post<CusFpApply>({ url: adminPath + '/shop/order/cusFpApply/updateStatus', params });

export const uploadKpResult = (params?: CusFpApply | any) =>
  defHttp.post<CusFpApply>({ url: adminPath + '/shop/order/cusFpApply/uploadKpResult', params });

export const clearKpResult = (params?: CusFpApply | any) =>
  defHttp.post<CusFpApply>({ url: adminPath + '/shop/order/cusFpApply/clearKpResult', params });
